<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common/base_body_header.jsp" %>
<%@include file="../common/navbar.jsp" %>
<%@include file="../common/page_content_pre.jsp" %>

<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <form class="form-horizontal" role="form" action="${GLOBAL.basePath}/Emily/list" method="post">
                <%--<fieldset>--%>
                <%--<div class="form-group">--%>

                <%--<div class="col-sm-2">--%>
                <%--<button class="btn btn-primary btn-sm" onsubmit="return false;">--%>
                <%--查询--%>
                <%--<i class="icon-search align-top bigger-125 icon-on-right"></i>--%>
                <%--</button>--%>
                <%--</div>--%>
                <%--</div>--%>
                <%--</fieldset>--%>
            </form>
        </div>
        <div class="col-xs-12">
            <div class="table-responsive">
                <table id="list-table" class="table table-striped table-bordered table-hover" width="100%">
                    <thead>
                    <tr>
                        <th style="text-align:center;">姓名</th>
                        <th style="text-align:center;">电话</th>
                        <th style="text-align:center;">年龄</th>
                        <th style="text-align:center;">性别</th>
                        <th style="text-align:center;">多大了解家教</th>
                        <th style="text-align:center;">家教年花费</th>
                        <th style="text-align:center;">购买过的产品</th>
                        <th style="text-align:center;">推荐产品</th>
                        <th style="text-align:center;">家教需求</th>
                        <th style="text-align:center;">
                            <i class="icon-time bigger-110 hidden-480"></i>添加时间
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
</div>

<%@include file="../common/page_content_suf.jsp" %>
<%@include file="../common/script.jsp" %>

<script type="text/javascript">

    var euserListTable;

    jQuery(function ($) {

        $("#add_btn").on("click", function () {
            addClick();
        });

        $('.date-picker').datepicker({autoclose: true}).next().on(ace.click_event, function () {
            $(this).prev().focus();
        });

        euserListTable = $('#list-table').dataTable({
            "sAjaxSource": "${GLOBAL.basePath}/Emily/customer/asynList",
            "fnServerData": function (sSource, aDataSet, fnCallback) {
                $.ajax({
                    "dataType": 'json',
                    "type": "POST",
                    "url": sSource,
                    "data": aDataSet,
                    "success": fnCallback,
                    "beforeSend": function (XMLHttpRequest) {
                        layer.load();
                    },
                    "complete": function (XMLHttpRequest, textStatus) {
                        layer.closeAll('loading');
                    }
                });
            },
            "fnServerParams": function (aoData) {//向服务器传额外的参数
                <c:if test="${not empty aoData}">
                aoData.push(${aoData});
                </c:if>
            },
            "bSort": false,
            "bFilter": false,
            "bServerSide": true,
            "bProcessing": false,
            "bLengthChange": false,
            "bSearching": false,
            "sProcessing": "${GLOBAL.staticImagePath}/loading.gif' />",
            "oLanguage": {
                "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条",
                "sInfoEmpty": "No data"
            },
            "aoColumns": [
                {"mDataProp": "name", "sWidth": "180px"},
                {"mDataProp": "phone", "sWidth": "180px"},
                {"mDataProp": "age", "sWidth": "100px"},
                {"mDataProp": "sex", "sWidth": "100px"},
                {"mDataProp": "age1", "sWidth": "180px"},
                {"mDataProp": "money", "sWidth": "180px"},
                {"mDataProp": "money", "sWidth": "180px"},
                {"mDataProp": "buyproduct", "sWidth": "180px"},
                {"mDataProp": "demand", "sWidth": "180px"},
                {"mDataProp": "createtime", "sWidth": "180px"}
            ]
        });
    });


    var delClick = function (obj) {
        layer.confirm("确定要开通该课程？", {
            title: '提示',
            btn: ['确认', '取消'], //按钮
            area: ['auto', 'auto'] //宽高
        }, function () {
            var result = ART.mAjax("${GLOBAL.basePath}/Emily/delete", "POST", {id: $(obj).attr("pkId")});
            layer.alert("开通成功", {icon: 1, title: '提示', btn: ['OK']});
            euserListTable.fnDraw();
        })
    }
</script>
